package JDBC;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

public class Example02 {
    public static void main(String[] args) throws ClassNotFoundException, SQLException {
    Class.forName("com.mysql.cj.jdbc.Driver");
    //2.获取连接
    Connection conn= DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/student?characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai","root","新的密码");
    //3.定义SQL语句
    String sql="UPDATE account SET id=5 WHERE money=1000.00";
    //4.获取执行SQL的对象
    Statement stmt=conn.createStatement();
    //5.执行SQL语句
    int count= stmt.executeUpdate(sql);
    System.out.println(count);
    stmt.close();
    conn.close();
    }
}
